package com.sunday.redisson.lock;

import com.google.gson.Gson;
import com.sunday.common.core.enums.ErrorCodeEnum;
import com.sunday.redisson.annotation.OpenDistributedLock;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Description:
 * @Author: zsy
 * @Create: 2022/2/18 15:29
 */
@Data
//@OpenDistributedLock("class_lock_user")
//@OpenDistributedLock(value = "class_lock_user", errorCodeEnum = ErrorCodeEnum.C0_112)
//@OpenDistributedLock(value = "class_lock_user", message = "自定义错误")
//@OpenDistributedLock(value = "class_lock_user", errorCodeEnum = ErrorCodeEnum.A0_001, message = "2333")
@OpenDistributedLock(value = "class_lock_user", errorCodeEnum = ErrorCodeEnum.A0_001)
public class UserDTO implements Serializable {

    //    @Positive
    @OpenDistributedLock("field_lock_id")
    private Long id;
    //    @NotBlank
    @OpenDistributedLock("field_lock_name")
//    @OpenDistributedLock(value = "field_lock_name", message = "field_lock_name")
//    @OpenDistributedLock(value = "field_lock_name", errorCodeEnum = ErrorCodeEnum.A0_001, message = "field_lock_name")
    private String name;
    //    @Positive
//    @OpenDistributedLock("field_lock_age")
    private Integer age;
    //    @OpenDistributedLock("field_lock_ids")
//    @OpenDistributedLock(value = "field_lock_ids", errorCodeEnum = ErrorCodeEnum.A0_001, message = "field_lock_ids")
    private List<Integer> ids;
    //    @OpenDistributedLock("field_lock_arr")
//    @OpenDistributedLock(value = "field_lock_arr", message = "123")
//    @OpenDistributedLock(value = "field_lock_arr", errorCodeEnum = ErrorCodeEnum.A0_001, message = "field_lock_arr")
    private Integer[] arr;
    //    @OpenDistributedLock("field_lock_map")
    private Map map;
    @OpenDistributedLock("field_lock_strIds")
    private List<String> strIds;
    @OpenDistributedLock("field_lock_strArr")
    private String[] strArr;
    @OpenDistributedLock("field_lock_setIds")
    private Set<String> setIds;

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }

}
